package com.foyekoo.project001.utils;

import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;

import com.foyekoo.project001.config.DataConfig;

/**
 * ${huneng} on 2018/7/31 11:46
 */

public class SendHeartBeatThread extends BaseThread {


    private UsbDeviceConnection connection;
    private UsbEndpoint[][] endpoint;

    public void setConnection(UsbDeviceConnection connection, UsbEndpoint[][] point) {
        this.connection = connection;
        this.endpoint = point;
    }


    @Override
    public void run() {
        super.run();

        while(isRunning){
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            byte[] data = DataConfig.HEART_BEAT;
            connection.bulkTransfer(endpoint[1][0], data, data.length, 30);
        }
    }


}
